1. Field
The embodiments relate to compiler technology, and more particularly to compiler optimization through register class assignment.
2. Description of the Related Art
When designing and implementing compilers, register allocation and register assignment are very important in increasing a computer program's efficiency. Register allocation determines the program values that should be stored in a machine's (e.g., a computer system) registers at each program point instead of being stored in the memory. Register assignment determines which register each allocated program value should be located. Compiler developers sometimes ignore register class assignment. The reason why register class assignment is usually ignored is because most machines contain very few register classes. Typically, most machines only have two sorts of registers: integer and floating-point registers.
For those machines having two register classes (i.e., integer and floating point), each register operand of an instruction requires a fixed register class, i.e. the register class assignment is explicitly performed during the instruction set architecture (ISA) design. In view of modern computer architecture design, however, register class assignment becomes increasingly difficult to determine. For example, in some advanced processors abundant register classes are available. And, an instruction register operand is allowed to be assigned with a physical register in different register classes.
To make the problem more complicated, the register class assignment can not be performed randomly. Only specified register classes can be applied to a register operand for a specified instruction. FIGS. 1A and 1B illustrate an example that demonstrates flexible register class assignment to an arithmetic logical unit (ALU) instruction. FIG. 1A illustrates an example of an ALU instruction. FIG. 1B illustrates an example of possible register class assignment to symbolic registers A_OP and B_OP. This kind of complexity makes the compiler design and implementation more and more challenging.